package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "qpurchase", schema = "springboot", catalog = "")
public class QpurchaseEntity {
    private int purchaseId;
    private String purchaseDh;
    private String purchaseZhuti;
    private String purchaseCgje;
    private Timestamp purchaseCgdate;
    private Timestamp purchaseDhdate;
    private String purchaseJbr;
    private String purchaseZt;
    private List<QpurchasecbEntity> qpurchasecbEntities;
    private QhandledEntity handledId; //进商人id

    @ManyToOne
    @JoinColumn(name = "handled_id", referencedColumnName = "handled_id")
    public QhandledEntity getHandledId() {
        return handledId;
    }

    public void setHandledId(QhandledEntity handledId) {
        this.handledId = handledId;
    }


    @OneToMany(mappedBy = "purchaseId")
    public List<QpurchasecbEntity> getQpurchasecbEntities() {
        return qpurchasecbEntities;
    }
    public void setQpurchasecbEntities(List<QpurchasecbEntity> qpurchasecbEntities) {
        this.qpurchasecbEntities = qpurchasecbEntities;
    }


    @Id
    @Column(name = "purchase_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getPurchaseId() {
        return purchaseId;
    }

    public void setPurchaseId(int purchaseId) {
        this.purchaseId = purchaseId;
    }

    @Basic
    @Column(name = "purchase_jbr")
    public String getPurchaseJbr() {
        return purchaseJbr;
    }

    public void setPurchaseJbr(String purchaseJbr) {
        this.purchaseJbr = purchaseJbr;
    }
    @Basic
    @Column(name = "purchase_zt")
    public String getPurchaseZt() {
        return purchaseZt;
    }

    public void setPurchaseZt(String purchaseZt) {
        this.purchaseZt = purchaseZt;
    }

    @Basic
    @Column(name = "purchase_cgdate")
    public Timestamp getPurchaseCgdate() {
        return purchaseCgdate;
    }

    public void setPurchaseCgdate(Timestamp purchaseCgdate) {
        this.purchaseCgdate = purchaseCgdate;
    }

    @Basic
    @Column(name = "purchase_dhdate")
    public Timestamp getPurchaseDhdate() {
        return purchaseDhdate;
    }

    public void setPurchaseDhdate(Timestamp purchaseDhdate) {
        this.purchaseDhdate = purchaseDhdate;
    }

    @Basic
    @Column(name = "purchase_dh")
    public String getPurchaseDh() {
        return purchaseDh;
    }

    public void setPurchaseDh(String purchaseDh) {
        this.purchaseDh = purchaseDh;
    }

    @Basic
    @Column(name = "purchase_zhuti")
    public String getPurchaseZhuti() {
        return purchaseZhuti;
    }

    public void setPurchaseZhuti(String purchaseZhuti) {
        this.purchaseZhuti = purchaseZhuti;
    }

    @Basic
    @Column(name = "purchase_cgje")
    public String getPurchaseCgje() {
        return purchaseCgje;
    }

    public void setPurchaseCgje(String purchaseCgje) {
        this.purchaseCgje = purchaseCgje;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        QpurchaseEntity that = (QpurchaseEntity) o;
        return purchaseId == that.purchaseId &&
                Objects.equals(purchaseDh, that.purchaseDh) &&
                Objects.equals(purchaseZhuti, that.purchaseZhuti) &&
                Objects.equals(purchaseCgje, that.purchaseCgje);
    }

    @Override
    public int hashCode() {
        return Objects.hash(purchaseId, purchaseDh, purchaseZhuti, purchaseCgje);
    }
}
